home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / dpmigcc5.zip / RSX / SOURCE / FS.H < prev    next >
C/C++ Source or Header  |  1994-12-12  |  3KB  |  96 lines

  1. #ifndef _FS_H
  2. #define _FS_H
  3.  
  4. #define FMODE_READ  1
  5. #define FMODE_WRITE 2
  6.  
  7. #if !defined (FD_SETSIZE)
  8.  
  9. #define FD_SETSIZE 256
  10. typedef struct _fd_set
  11. {
  12.   unsigned long bits[(FD_SETSIZE+31) / 32];
  13. } fd_set;
  14.  
  15. #define fd_index(c) ((c) >> 5)
  16. #define fd_mask(c) (1 << ((c) & 31))
  17. #define FD_SET(fd, map)     ((map)->bits[fd_index(fd)] |= fd_mask(fd))
  18. #define FD_CLR(fd, map)     ((map)->bits[fd_index(fd)] &= ~(fd_mask(fd)))
  19. #define FD_ISSET(fd, map)   ((map)->bits[fd_index(fd)] & fd_mask(fd))
  20. #define FD_ZERO(s)        (void)memset(s, 0, sizeof (*(s)))
  21.  
  22. #endif
  23.  
  24. typedef struct
  25. {
  26.     unsigned long bits[N_FD];
  27. } p_fdset;
  28.  
  29.  
  30. struct pipe_info {
  31.     unsigned long   memhandle;
  32.     unsigned long   memaddress;
  33.     long        pos;
  34.     long        len;
  35.     long        size;
  36.     unsigned int    rd_openers;
  37.     unsigned int    wr_openers;
  38.     unsigned int    readers;
  39.     unsigned int    writers;
  40.     unsigned int    sel;
  41. } ;
  42.  
  43. union file_info {
  44.     struct pipe_info    pipe_i;
  45.     /* others */
  46. };
  47.  
  48. struct file {
  49.     unsigned short        f_mode;        /* 1=RD, 2=WR */
  50.     unsigned short        f_flags;        /* NDELAY etc */
  51.     unsigned short        f_count;        /* no processes */
  52.     short            f_doshandle;    /* real dos handle or -1 */
  53.     unsigned long        f_offset;        /* seek pos */
  54.     struct file_operations *f_op;        /* file ops */
  55.     union file_info *        f_info;        /* extra information */
  56. };
  57.  
  58. typedef long ARGUSER;
  59.  
  60. struct file_operations {
  61.     long (*lseek) (struct file *, long, int);
  62.     ARGUSER (*read) (struct file *, ARGUSER, ARGUSER);
  63.     ARGUSER (*write) (struct file *, ARGUSER, ARGUSER);
  64.     int (*select) (struct file *, DWORD);
  65.     int (*ioctl) (struct file *, ARGUSER, ARGUSER);
  66.     int (*open) (struct file *, ARGUSER);
  67.     void (*release) (struct file *);
  68. };
  69.  
  70. extern struct file rsx_filetab[RSX_NFILES];
  71.  
  72. struct _select {
  73.     DWORD nfds;
  74.     DWORD readfds;
  75.     DWORD writefds;
  76.     DWORD excepfds;
  77.     DWORD time;
  78. };
  79.  
  80. void        init_rsx_filetab(void);
  81. int        get_empty_proc_filp(void);
  82. int        get_dos_handle(int);
  83. int        sys_close(int);
  84. int        sys_dup2(unsigned int, unsigned int);
  85. int        sys_dup(unsigned int);
  86. ARGUSER     sys_read(int fd, ARGUSER buf, ARGUSER bytes);
  87. ARGUSER     sys_write(int fd, ARGUSER buf, ARGUSER bytes);
  88. long        sys_lseek(int fd, long off, int orgin);
  89. int        sys_select(ARGUSER select);
  90. int        sys_ioctl(int fd, ARGUSER request, ARGUSER arg);
  91. int        sys_pipe(ARGUSER size, ARGUSER arg);
  92.  
  93. extern struct file_operations msdos_fop;
  94. extern struct file_operations pipe_fop;
  95. #endif /* _FS_H */
  96.